import Cookies from 'js-cookie'

const TokenKey = 'vue_admin_template_token'
const OpenIdKey = 'vue_open_id'
const UserNameKey = 'vue_user_name'
const UserKey = 'vue_user'

export function getUser() {
  //return Cookies.get(UserKey)
  return localStorage.getItem(UserKey) || ''
}

export function setUser(user) {
  //return Cookies.set(UserKey, user)
  return localStorage.setItem(UserKey,JSON.stringify(user))
}

export function removeUser() {
  //return Cookies.remove(UserKey)
  return localStorage.removeItem(UserKey)
}

export function getUserName() {
  return Cookies.get(UserNameKey)
}

export function setUserName(userName) {
  return Cookies.set(UserNameKey, userName)
}

export function removeUserName() {
  return Cookies.remove(UserNameKey)
}

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}